-
Notifications
You must be signed in to change notification settings - Fork 202
Fix invoice.upcoming webhook handler failure - generate unique document ID for invoices without id #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
|
…out id Co-authored-by: Ehesp <842078+Ehesp@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Form Name: Landlord Onboarding – Listing Setup
Campaign: turbotenant-landlord-onboarding
Form Fields
- Full Name (required)
- Email Address (required)
- Phone Number
- Password (min 8 characters)
- Confirm Password
- Property Address (required)
- City / State / ZIP
- Type of Property (Apartment, House, Condo)
- Monthly Rent
- Available From Date
- Upload Property Photos
Form Settings
- Submit Button Label:
Create My Listing & Continue
- On Success → Redirect To:
https://www.turbotenant.com/login/?campaignId=4fc68144-3683-4e9f-a15b-145fe308044f&interactiveId=288590217439&container=modal&source=hubspot&portalId=147061670/manage/{{listing_id}}/marketing
php-template
Copy code
Hidden Tracking Fields
utm_campaign=property_setup_flow
utm_source=landing_page
integration_source=turbotenant.com/onboard
🌐 Frontend / HTML Configuration
Below is the core front-end entry HTML for the TurboTenant onboarding and dashboard environment.
This integrates Google Tag Manager, Branch.io analytics, Google Fonts, and the TurboTenant PWA setup.
import pypandoc
Markdown content combining the webhook setup and TurboTenant welcome email
markdown_content = """
🔗 TurboTenant Landlord Onboarding + Stripe Webhook Integration
Webhook Configuration
Event Source: Connected and v2 accounts
Payload Format: Thin
API Version: Unversioned
Events Subscribed: 15
Destination Name: TurboTenant Landlord Onboarding
Endpoint URL:
https://www.turbotenant.com/api/webhooks/stripe
(replace with your actual webhook URL)
Description:
Handles essential Stripe events related to landlord onboarding, payment setup, and property listing flows within TurboTenant.
Email Configuration
Sender Name: TurboTenant Support
From: no-reply@turbotenant-landlord-onboardin.firebaseapp.com
Reply-To: support@turbotenant.com
This setup ensures the verification email is delivered with clear sender info and directs any replies to your actual support inbox.
🏡 Welcome to TurboTenant!
Built by landlords, for landlords — TurboTenant makes it easy to find qualified tenants for free in just a few clicks.
🏠 Create Your Listing
If you’ve already started, you’re ahead of the game! If not, it’s quick to set up — just add your photos, description, amenities, and rent amount to make your listing stand out.
🚀 Advertise with One Click
Save time by instantly posting your rental across top property sites like Rent.com, Apartments.com, Realtor.com, and more.
📥 Manage Leads Effortlessly
You’ll receive an email whenever someone is interested in your property. Each lead completes an automatic pre-screening questionnaire, helping you track all your prospects in one place.
📝 Invite Qualified Renters to Apply
Once you find the right renter, invite them to apply directly through TurboTenant — it’s free for landlords! Every application includes a full industry-standard screening report.
MANAGE MY LISTING
⭐️ Want faster reviews and top-tier site visibility?
Upgrade to our Premium Subscription for priority placement and enhanced exposure.
📚 Resources for Landlords
Every successful landlord knows that knowledge is power. Explore our free learning resources:
- TurboTenant Photo Guidelines
- Marketing Your Rental Webinar
- TurboTenant Onboarding Course
- TurboTenant Academy
📱 Manage Rentals Anywhere
Stay connected anywhere with the TurboTenant Mobile App — download today!
🎁 Give $25, Get $25!
Know someone who could use TurboTenant? Refer them today and you’ll both earn $25.
Support
Need help? Visit our Help Center or email our Colorado-based support team at support@turbotenant.com.
TurboTenant, Inc © 2025
320 E Vine Dr., Fort Collins, CO 80524
Manage Email Preferences | Unsubscribe
Terms of Service | Privacy Policy
🔗 Login Link for Internal Review
"""
Save as a .md file
output_path = "/mnt/data/turbotenant-landlord-onboarding.md"
with open(output_path, "w", encoding="utf-8") as f:
f.write(markdown_content)
output_path
Problem
The
invoice.upcoming
webhook event was failing with the error:This occurred because upcoming invoices from Stripe don't have an
id
field, causing the Firestore document path to be invalid when trying to create the invoice document.Root Cause
In the
insertInvoiceRecord
function inutils.ts
, the code was attempting to useinvoice.id
directly as the Firestore document ID:For
invoice.upcoming
events, Stripe doesn't provide anid
field since these are preview/draft invoices that haven't been finalized yet.Solution
The fix generates a unique document ID for upcoming invoices when
invoice.id
is null/undefined:Additionally, the fix prevents creating unnecessary payment records for upcoming invoices when they don't have a payment intent, since upcoming invoices are previews and don't represent actual payments:
Impact
invoice.upcoming
eventsTest Cases Handled
upcoming_{subscription}_{timestamp}
), skips payment record if no payment_intentFixes #616
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.